﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Configuration;
using BLL;
using DAL;

public partial class Plublic_Profile : System.Web.UI.Page
{
    String StrConn = WebConfigurationManager.ConnectionStrings["conn"].ConnectionString.ToString();
    UsersHandler objUsersHandler = new UsersHandler();

    protected void Page_Load(object sender, EventArgs e)
    {
        int UserId = Convert.ToInt32(Session["UserId"]);

        Users objUsers = new Users();

        objUsers = objUsersHandler.GetUsersDetails(UserId, StrConn);

        this.lblUserName.Text = objUsers.UserName.ToString();
        this.lblEmail.Text = objUsers.Email.ToString();
        this.lblPhone.Text = objUsers.Phone.ToString();
        this.lblDescription.Text = "";

        this.txtPassword.Text = objUsers.Password.ToString();
        this.txtEmail.Text = objUsers.Email.ToString();
        this.txtPhone.Text = objUsers.Phone.ToString();
        this.txtDes.Text = objUsers.Descriptions.ToString();

    }
    protected void edit_Click(object sender, EventArgs e)
    {
       
        
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        int UserId = Convert.ToInt32(Session["UserId"]);
        Users objUsers = new Users();
        objUsers = objUsersHandler.GetUsersDetails(UserId, StrConn);

        objUsers.Password = txtPassword.Text.ToString();
        objUsers.Email = txtEmail.Text.ToString();
        objUsers.Phone = txtPhone.Text.ToString();
        objUsers.Descriptions = txtDes.Text.ToString();

        objUsersHandler.UpdateUsers(objUsers, StrConn);
    }
}